package com.kangyi.admin.mapper;

import com.github.pagehelper.Page;
import com.kangyi.admin.annotation.AutoFill;
import com.kangyi.dto.NursingHomeEventPageQueryDTO;
import com.kangyi.entity.NursingHomeEvent;
import com.kangyi.enumeration.OperationType;
import com.kangyi.vo.NursingHomeEventVO;
import org.apache.ibatis.annotations.Delete;
import org.apache.ibatis.annotations.Insert;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Select;

import java.util.List;

/**
 * @author Blank
 * @version 1.0
 */
@Mapper
public interface NursingHomeEventMapper {

    Page<NursingHomeEventVO> pageQuery(NursingHomeEventPageQueryDTO nursingHomeEventPageQueryDTO);

    @Insert("insert into nursing_home_event(nursing_home_id, event_name, description, image,create_time, update_time, create_user, update_user)" +
            "values (#{nursingHomeId},#{eventName},#{description},#{image},#{createTime},#{updateTime},#{createUser},#{updateUser})")
    @AutoFill(value = OperationType.INSERT)
    void addEvent(NursingHomeEvent nursingHomeEvent);

    @Select("select * from nursing_home_event where id = #{id};")
    NursingHomeEventVO getEvent(Integer id);

    void editEvent(NursingHomeEvent nursingHomeEvent);

    void deleteEvent(List<Integer> ids);

    @Delete("delete from nursing_home_event where nursing_home_id = #{nursingHomeId};")
    void deleteNursingHomeId(Integer nursingHomeId);
}
